function [X,D]=eivmod(A)
% Eigenvalue decomposition with negative eigenvalue reversed signs
% for indefinite hessian in Newton's method
% INPUT:
%       A ~ the matrix to factorize
% OUTPUT:
%       X ~ matrix containing the original eigenvector of A;
%       D ~ diagonal matrix with all positive eigenvalues;
% REVISION:
%       jqin, 18/feb/2011;
[X,D]=eig(A);
D=abs(D);